package com.xuecheng.content.agent.sentinel;

import com.xuecheng.api.media.model.dto.MediaDTO;
import com.xuecheng.common.domain.code.CommonErrorCode;
import com.xuecheng.common.domain.response.RestResponse;
import com.xuecheng.content.agent.MediaApiAgent;
import feign.hystrix.FallbackFactory;
import org.springframework.stereotype.Component;


@Component
public class MediaApiAgentFallBackFactory implements FallbackFactory<MediaApiAgent> {
    @Override
    public MediaApiAgent create(Throwable throwable) {
        return new MediaApiAgent() {
            @Override
            public RestResponse<MediaDTO> getMediaById4s(Long mediaId) {
                return RestResponse.validfail(CommonErrorCode.E_999982);
            }
        };
    }
}
